<template>
  <b-container fluid>
    <b-card-group deck>
      <b-card class="mb-3" bg-variant="light">
        <b-row>
          <b-col md="2" lg="2" xl="2">
            <b-form-group label="用户名" label-size="sm">
              <b-input v-model="form.username" size="sm" placeholder="用户名"/>
            </b-form-group>
          </b-col>
          <b-col md="2" lg="2" xl="2">
            <b-button @click="getData" variant="info" size="sm" class="mt-4">查询</b-button>
          </b-col>
        </b-row>
      </b-card>
    </b-card-group>

    <b-card-group deck>
      <b-card class="mb-3" border-variant="secondary" header-border-variant="secondary" no-body>
        <span slot="header">
          <a>数据</a>
          <b-button size="sm" class="ml-3" @click="() => $refs['modal-edit'].show()">添加菜单</b-button>
        </span>
        <b-table bordered small striped hover :items="base.results"/>
        <b-pagination
          v-model="p"
          :per-page="ps"
          aria-controls="my-table"
        ></b-pagination>
      </b-card>
    </b-card-group>

    <b-modal ref="modal-edit" @ok="$refs['modal-edit'].hide()">
      <b-form>
        <b-form-group label="菜单名称:" label-cols-sm="2" label-size="sm" >
          <b-form-input v-model="model.name" :state="!!model.name" size="sm" ></b-form-input>
        </b-form-group>
        <b-form-group label="路由名称:" label-cols-sm="2" label-size="sm" >
          <b-form-input  v-model="model.route" :state="!!model.route" size="sm" ></b-form-input>
        </b-form-group>
        <b-form-group label="模版路径:" label-cols-sm="2" label-size="sm" >
          <b-form-input v-model="model.path" :state="!!model.path" size="sm" ></b-form-input>
        </b-form-group>
        <b-form-group label="上级ID:" label-cols-sm="2" label-size="sm" >
          <b-form-input v-model="model.partner_id" :state="!!model.partner_id" size="sm" />
        </b-form-group>
        <b-form-group label="状态:" label-cols-sm="2" label-size="sm" >
          <b-form-checkbox :value="model.status?true:false" @input="model.status=arguments[0]?1:0" :state="!!model.status" switch />
        </b-form-group>
      </b-form>
    </b-modal>

  </b-container>
</template>

<script>
import base from '@/mixins';
export default {
  mixins: [base]
}
</script>

<style>

</style>
